package lwlk.tools;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Param {

    private boolean hang = false;

    private boolean stir(Object ignored) { return hang = !hang; }

    private Param() { }

    public static Map<String, Object> of(Object ... args) {

        Param param = new Param();

        Map<Boolean, List<Object>> kv = Arrays.stream(args).collect(Collectors.partitioningBy(param::stir));

        List<String> k = kv.get(true).stream().map(String.class::cast).collect(Collectors.toList());

        List<Object> v = kv.get(false);

        return IntStream.range(0, k.size()).boxed().collect(Collectors.toMap(k::get, v::get));
    }
}
